package chess.model;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;

import chess.parsers.GeneralParser;
import chess.utils.Style12;


public class ChessBoardPos{
	
	protected transient PropertyChangeSupport listeners = new PropertyChangeSupport(this);
	
//	private String[][] positions = new String[8][8];
	
	private Style12 style12;
	
	public ChessBoardPos(){
		System.out.println("AFDFDSKJFSJFNHDSLFJHLDSFJLDSJFLKDSJFLDSHFLDSHF");
//		new ChessBoardParser(this);
		new GeneralParser(this);
	}
	
	/**
	 * @param positions the positions to set
	 */
	public void setPositions(Style12 style) {
		this.style12 = style;
		firePropertyChange("all", null, style);
	}

	/**
	 * @return the positions
	 */
	public Style12 getPositions() {
		return style12;
	}
	
//	public void setInitialPositions(){
//		positions[0][0]="r";
//		positions[1][0]="n";
//		positions[2][0]="b";
//		positions[3][0]="k";
//		positions[4][0]="q";
//		positions[5][0]="b";
//		positions[6][0]="n";
//		positions[7][0]="r";
//		for(int a=0;a<8;a++){
//			positions[a][1]="p";
//			positions[a][6]="p";
//		}
//		positions[0][7]="R";
//		positions[1][7]="N";
//		positions[2][7]="B";
//		positions[3][7]="K";
//		positions[4][7]="Q";
//		positions[5][7]="B";
//		positions[6][7]="N";
//		positions[7][7]="R";
//		firePropertyChange("position", null, positions);
//	}
	
	public void addPropertyChangeListener(PropertyChangeListener l){
        if (l == null) {
            throw new IllegalArgumentException();
        }
        this.listeners.addPropertyChangeListener(l);
    }
	
	public void removePropertyChangeListener(PropertyChangeListener l){
        this.listeners.removePropertyChangeListener(l);
    }
	
	protected void firePropertyChange(String prop, Style12 old, Style12 newValue){
        if (this.listeners.hasListeners(prop)) {
            this.listeners.firePropertyChange(prop, old, newValue);
        }
    }



}
